<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>炭银网 管理后台</title>
	<link href="<%url('css/bootstrap/bootstrap.css')%>" rel="stylesheet" />
	<link href="<%url('css/libs/font-awesome.css')%>" type="text/css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="<%url('css/compiled/layout.css')%>">
	<link rel="stylesheet" type="text/css" href="<%url('css/compiled/elements.css')%>">
	<link rel="stylesheet" href="<%url('user/css/sweet-alert.css')%>" />
	<link rel="stylesheet" href="<%url('user/css/animate.css')%>" />
</head>
<body id="login-page">
	<div class="container">
		<div class="row">
			<div class="col-xs-12">
				<div id="login-box">
					<div class="row">
						<div class="col-xs-12 clearfix" id="login-box-header">
							<div class="login-box-header-red"></div>
							<div class="login-box-header-green"></div>
							<div class="login-box-header-yellow"></div>
							<div class="login-box-header-purple"></div>
							<div class="login-box-header-blue"></div>
							<div class="login-box-header-gray"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-12">
							<div id="login-box-inner">
								<div id="login-logo">
									<img width="100" src="<%url('user/img/logo.jpg')%>" alt=""/> 后台登陆
								</div>

							<div role="form">
									<div class="input-group input-group-lg">
										<span class="input-group-addon"><i class="fa fa-user"></i></span>
										<input class="form-control" id="username" type="text" placeholder="账号">
									</div>
									<div class="input-group input-group-lg">
										<span class="input-group-addon"><i class="fa fa-key"></i></span>
										<input type="password" id="password" class="form-control" placeholder="密码">
									</div>

									<div class="row">
										<div class="col-sm-6 col-xs-12 col-sm-push-6">
											<button type="button" id="doLogin" class="btn btn-success col-xs-12">登陆</button>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="<%url('js/jquery.js')%>"></script>
	<script src="<%url('js/bootstrap.js')%>"></script>
	<script src="<%url('js/scripts.js')%>"></script>
	<script src="<%url('user/js/jquery.md5.js')%>"></script>
	<script type="text/javascript" src="<%url('user/js/art-tmpl/template.js')%>"></script>
	<script type="text/javascript" src="<%url('user/js/art-tmpl/template-syntax.js')%>"></script>
	<script src="<%url('user/js/common.js')%>"></script>
	<script src="<%url('user/js/sweet-alert.min.js')%>"></script>
</body>
<script type="text/javascript">

$("#doLogin").click(function(){
	var username = $("#username").val().trim();
	var password = $("#password").val().trim();
	if(username == ''){
		error('','请输入用户名');
		return;
	}
	if(password == ''){
		error('','请输入密码');
		return;
	}
	$.post("<%url('dologin')%>", {
		username : username,
		password : encrypt(password)
	}, function(data){
		if(data.success){
			window.location.href="<% url('admin') %>";
		}else{
			error('', data.msg);
			var jump = data.msg.redirect;
			if(jump){
				setTimeout(function(){
					window.location.href=jump;
				},1000);
			}
		}
	})

})

</script>
</html>